package com.zhu.demodb.service.impl;

import com.zhu.demodb.entity.Man;
import com.zhu.demodb.mapper.ManMapper;
import com.zhu.demodb.service.ManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class ManServiceImpl implements ManService {

    @Autowired
    ManMapper mapper;

    @Override
    public int create(String name, int age) {
        Man man = new Man();
        man.setId(UUID.randomUUID().toString());
        man.setName(name);
        man.setAge(age);
        return mapper.createMan(man);
    }

    @Override
    public Man getByid(String id) {
        return mapper.getMan(id);
    }
}
